<template>
    <view class="fwxq">
        <view v-if="store && store.details != ''">
            <view class="title">
                <view class="hx"></view>
                <view class="hxwz">关于我们</view>
                <view class="hx"></view>
            </view>
            <view class="weui-cell" style="background: white; font-size: 26rpx; color: #666; margin-bottom: 20rpx">
                <rich-text :nodes="store.details"></rich-text>
            </view>
        </view>
        <view style="margin-bottom: 20rpx" v-if="store.store_video.length > 6">
            <view class="title">
                <view class="hx"></view>
                <view class="hxwz">商家视频</view>
                <view class="hx"></view>
            </view>
            <view class="video" v-if="store.store_video.length > 6">
                <video objectFit="fill" :src="store.store_video"></video>
            </view>
            <view style="background: #fff; padding: 10px 15px" v-else>商家暂未上传视频</view>
        </view>
        <block v-if="store.environment != ''">
            <view class="title">
                <view class="hx"></view>
                <view class="hxwz">商家环境</view>
                <view class="hx"></view>
            </view>
            <view class="xztpul">
                <view style="padding: 10px 15px" v-if="store.environment == ''">商家暂未上传图片</view>
                <block v-else>
                    <view class="scimg-box" v-for="(item, index) in store.environment" :key="index">
                        <image @tap="previewImage" class="scimg" :data-urls="store.environment" :id="item" mode="widthFix" :src="item"></image>
                    </view>
                </block>
            </view>
        </block>
        <block v-if="store.yyzz != ''">
            <view class="title" style="margin-top: 20rpx">
                <view class="hx"></view>
                <view class="hxwz">商家资质</view>
                <view class="hx"></view>
            </view>
            <view class="xztpul">
                <view style="padding: 10px 15px" v-if="store.yyzz == ''">商家暂未上传资质</view>
                <block v-else>
                    <view class="scimg-box" v-for="(item, index) in store.yyzz" :key="index">
                        <image @tap="previewImage" class="scimg" :data-urls="store.yyzz" :id="item" mode="widthFix" :src="item"></image>
                    </view>
                </block>
            </view>
        </block>
    </view>
</template>

<script>
import cardlist from '@/ymq_canyino2o/dist/cardlist/index';
import gettel from '@/ymq_canyino2o/dist/gettel/index';
var app = getApp();
export default {
    components: {
        cardlist,
        gettel
    },
    data() {
        return {
            store: {
                details: '',
                store_video: [],
                environment: '',
                yyzz: ''
            }
        };
    },
    onLoad: function (t) {
        app.globalData.setNavigationBarColor(this);
        this.reLoad();
    },
    onReady: function () {},
    onShow: function () {},
    onHide: function () {},
    onUnload: function () {},
    onPullDownRefresh: function () {
        this.reLoad();
        setTimeout(function () {
            uni.stopPullDownRefresh();
        }, 1500);
    },
    onReachBottom: function () {},
    onShareAppMessage: function () {},
    methods: {
        reLoad: function () {
            var that = this;
            app.globalData.util.request({
                url: 'entry/wxapp/Url',
                cachetime: '0',
                success: function (a) {
                    console.log(a.data);
                    app.globalData.util.request({
                        url: 'entry/wxapp/StoreInfo',
                        cachetime: '0',
                        data: {
                            store_id: getApp().globalData.sjid
                        },
                        success: function (t) {
                            for (var e = 0; e < t.data.store.environment.length; e++) {
                                t.data.store.environment[e] = a.data + t.data.store.environment[e];
                            }
                            for (var o = 0; o < t.data.store.yyzz.length; o++) {
                                t.data.store.yyzz[o] = a.data + t.data.store.yyzz[o];
                            }
                            console.log(t);
                            that.setData({
                                store: t.data.store
                            });
                        }
                    });
                }
            });
        },

        previewImage: function (t) {
            uni.previewImage({
                current: t.currentTarget.id,
                urls: t.currentTarget.dataset.urls
            });
        }
    }
};
</script>
<style>
@import './infomation.css';
</style>
